#include "Atomic.h"
#include <Windows.h>

namespace Core
{
	int rtAtomic::operator ++ ()
	{
		return InterlockedIncrement(&m_iValue);
	}

	int rtAtomic::operator -- ()
	{
		return InterlockedDecrement(&m_iValue);
	}

	int rtAtomic::operator + (int i)
	{
		return InterlockedExchangeAdd(&m_iValue, i) + i;
	}

	int rtAtomic::operator - (int i)
	{
		return InterlockedExchangeAdd(&m_iValue, -i) - i;
	}

	int rtAtomic::getValue()
	{
		return m_iValue;
	}

	void rtAtomic::setValue(int value)
	{
		m_iValue = value;
	}
	rtAtomic::operator int() const
	{
		return m_iValue;
	}
}